using System;
using Calc.Execution;

namespace Calc.Operations.Functions
{
	public class Abs : Function
	{
		public const string NAME = "abs";

		public Abs()
			: base(NAME)
		{
			_variables.Add(new Variable("x"));
		}

		public override double GetValue(ExecutionContext context)
		{
			double x = context.GetVariable("x");

			return Math.Abs(x);
		}
	}
}
